package cn.fengsweb.tokyotyrant
{
	import cn.fengsweb.tokyotyrant.define.TokyoTyrantQueryFunctionName;
	
	import flash.utils.ByteArray;

	internal class SetIndex
	{
		private var _sendBytes:ByteArray;
		
		public function get sendBytes():ByteArray
		{
			return _sendBytes;
		}
		
		public function SetIndex(key:String, type:uint)
		{
			var kbuf:ByteArray	= new ByteArray();
				kbuf.writeUTFBytes(key);
			var tbuf:ByteArray	= new ByteArray();
				tbuf.writeUTFBytes(String(type));
			
			var query:TokyoTyrantQuery	= new TokyoTyrantQuery(TokyoTyrantQueryFunctionName.SET_INDEX);
				query.addArguments(kbuf);
				query.addArguments(tbuf);
			
			_sendBytes	= query.sendBytes;
		}
	}
}